# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
pkgname=php7-pecl-apcu
_pkgreal=apcu
pkgver=5.1.18
pkgrel=2
pkgdesc="PHP extension APC User Cache - PECL"
url="https://pecl.php.net/package/apcu"
arch="all"
license="PHP-3.01"
depends="php7-common"
makedepends="pcre2-dev php7-dev"
checkdepends="php7-pcntl php7-session"
source="https://pecl.php.net/get/$_pkgreal-$pkgver.tgz"
builddir="$srcdir/$_pkgreal-$pkgver"
provides="php7-apcu=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-apcu" # for backward compatibility

build() {
	phpize7
	./configure --prefix=/usr --with-php-config=php-config7
	make
}

check() {
	local modules="/usr/lib/php7/modules"
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test \
		PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=$modules/pcntl.so \
		-d extension=modules/$_pkgreal.so"
}

package() {
	make INSTALL_ROOT="$pkgdir"/ install
	install -D -m644 apc.php "$pkgdir"/usr/share/php7/apcu/apc.php

	install -d "$pkgdir"/etc/php7/conf.d
	echo "extension=$_pkgreal.so" > "$pkgdir"/etc/php7/conf.d/$_pkgreal.ini
}

sha512sums="5e9c5b4540be7abdf2f473d2f8955d8708934a1d6e05cb2c99154cc7ba8a2bbf9afde51769e20f46ef278efd6f60b9172e0864c31e0976b9d3096a337035e7a9  apcu-5.1.18.tgz"
